package com.vincent.template.repository;

import com.vincent.template.commons.base.BaseJpaRepository;
import com.vincent.template.domain.SysRolePo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Collection;
import java.util.List;

/**
 * @author Vincent Wang
 * @date 2020/12/30 11:27
 */
public interface SysRoleRepository extends BaseJpaRepository<SysRolePo, Long> {

    SysRolePo findByCode(String code);

    @Query("select code from SysRolePo where code in :codes and userRemovable = false")
    List<String> findUserUnremovableRoles(@Param("codes") Collection<String> codes);
}
